#pragma once

#include <atlbase.h>
#include <atlstr.h>
#include <Windows.h>
#include <commctrl.h>
#include <string>
using namespace std;

SHFOLDERAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
SHFOLDERAPI SHGetFolderPathW(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
#ifdef UNICODE
#define SHGetFolderPath  SHGetFolderPathW
#else
#define SHGetFolderPath  SHGetFolderPathA
#endif // !UNICODE

typedef enum {
	SHGFP_TYPE_CURRENT  = 0,   // current value for user, verify it exists
	SHGFP_TYPE_DEFAULT  = 1,   // default value, may not exist
} SHGFP_TYPE;


class CUtility
{
public:
	CUtility(void);
	~CUtility(void);

	static CUtility&  Instance()
	{
		TSAUTO();
		static CUtility s;
		return s;
	};

public:
	HWND FindFolderViewWindow(wstring szFoldername);
	bool SHExcute(TCHAR *szPathName);
	bool BSTRToLuaString( BSTR src, std::string& dest);
	bool LuaStringToCComBSTR(const char* src, CComBSTR& bstr);


	DWORD GetProcessIdByName(LPCTSTR name);
	CString GetProcessPathName(DWORD dwpId);
	HWND  GetXMPWindow();
	void  SetHostWnd(HWND);

public:
	CString GetXMPPath();

private:
	HWND m_hHostWnd;


};
#define Utility CUtility::Instance()